package com.eva.framework.rbac.session;

import com.eva.framework.rbac.model.RbacUserInfo;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 会话工具类
 */
@Component
public final class SessionUtil {

    private static SessionAdapter sessionAdapter;

    /**
     * 获取当前登录用户
     *
     * @return 当前登录用户信息
     */
    public static RbacUserInfo getLoginUser () {
        return sessionAdapter.getLoginUser();
    }

    @Resource
    public void setSessionAdapter (SessionAdapter sessionAdapter) {
        SessionUtil.sessionAdapter = sessionAdapter;
    }

}
